package com.vip.service.admin.impl;

import com.vip.dao.admin.dao.SysPermissionDao;
import com.vip.dao.admin.domain.SysPermission;
import com.vip.service.admin.SysPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
public class SysPermissionServiceImpl implements SysPermissionService {

    @Autowired
    SysPermissionDao permissionDao;

    @Override
    public SysPermission findPermissionById(Long id) {
        return permissionDao.findById(id).get();
    }

    @Override
    public Page<SysPermission> findAllSysPermission(int page, int size) {
        Pageable pageable = PageRequest.of(page,size);
        Page<SysPermission> permissionPage = permissionDao.findAll(pageable);
        return permissionPage;
    }
}
